package ace.cmp.spring.graphql.core.helper;

import graphql.language.ObjectTypeDefinition;
import graphql.language.Type;
import graphql.schema.idl.TypeDefinitionRegistry;

/**
 * @author caspar
 * @date 2023/8/26 10:00
 */
public interface TypeDefinitionRegistryHelper {
  /**
   * inject exist or not exist {@link ObjectTypeDefinition} with injectObjectTypeDefinition parameter
   *
   * @param registry
   * @param injectObjectTypeDefinition
   */
  void injectObjectTypeDefinition(
      TypeDefinitionRegistry registry, ObjectTypeDefinition injectObjectTypeDefinition);

  /**
   * inject a type to assign field of type,if not exist.
   * if it is exist nothing to do.
   *
   * @param registry          {@link TypeDefinitionRegistry}
   * @param typeName          type name
   * @param fieldOfType       field of type
   * @param injectTypeOfField type of field
   */
  void injectToAssignTypeField(
      TypeDefinitionRegistry registry, String typeName, String fieldOfType, Type injectTypeOfField);
}
